import store from '@/store'
import { isArray } from '@/utils/is.js'

/**
* @description 判断是否有角色权限
* @param { Array } permissionRoles
* @returns { Boolean }
*/
export default function hasPermission(permissionRoles) {
  if (!isArray(permissionRoles)) return false
  const roles = store.getters && store.getters['user/roles']
  return roles.some(role => {
    return permissionRoles.includes(role)
  })
}
